import { legacy_createStore,combineReducers,compose } from "redux";
import {persistStore, persistReducer} from 'redux-persist'

import CollapsedReducer from "./reducers/CollapsedReducer"
import LoadingReducer from "./reducers/LoadingReducer"

import storage from 'redux-persist/lib/storage'


// window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
let composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
  ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({})
  : compose

const persistConfig = {
    key: 'root',
    storage,
    // whitelist:["CollapsedReducer"]
    blacklist:['LoadingReducer']  //设置某个reducer数据不持久化，
 
}
const reducers =combineReducers({
    CollapsedReducer,
    LoadingReducer
})
const myPersistReducer = persistReducer(persistConfig, reducers)
const store =legacy_createStore(myPersistReducer,composeEnhancers())
const persistor = persistStore(store)
export default store

export {
    store,
    persistor
  }